<HTML>
  <HEAD>
    <TITLE>threadpool Documentation</TITLE>
    <LINK HREF="threadpool.css" REL="stylesheet" TYPE="text/css">
  </HEAD>
  <BODY BGCOLOR="#FFFFFF">

    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>

          <TD ALIGN="LEFT">
            <B>threadpool</B>
          </TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="../index.html">Overview</A> |
            <A CLASS="qindex" HREF="../reference/annotated.html">Reference</A> |
            <A CLASS="qindex" HREF="../tutorial/intro.html">Tutorial</A> |
            <A CLASS="qindex" HREF="../examples/intro.html">Examples</A> |
            <A CLASS="qindex" HREF="../design/intro.html">Design</A>
          </TD>

        </TR>
      </TABLE>
    </DIV>
    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>
          <TD ALIGN="LEFT">
            <B>Reference</B>
          </TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="annotated.html">Class List</A> |
            <A CLASS="qindex" HREF="functions.html">Member Functions</A> |
            <A CLASS="qindex" HREF="namespacemembers.html">Typedefs</A> |
            <A CLASS="qindex" HREF="files.html">File List</A>
          </TD>
        </TR>
      </TABLE>
    </DIV>
<!-- Generated by Doxygen 1.4.6-NO -->
<div class="nav">
<a class="el" href="a00035.html">boost</a>::<a class="el" href="a00036.html">threadpool</a>::<a class="el" href="a00020.html">prio_scheduler</a></div>
<h1>boost::threadpool::prio_scheduler&lt; Task &gt; Class Template Reference</h1><!-- doxytag: class="boost::threadpool::prio_scheduler" --><a href="a00005.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
<h3>template&lt;typename Task = prio_task_func&gt;<br>
 class boost::threadpool::prio_scheduler&lt; Task &gt;</h3>

SchedulingPolicy which implements prioritized ordering. 
<p>
This container implements a scheduling policy based on task priorities. The task with highest priority will be the first to be removed. It must be possible to compare two tasks using operator&lt;.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>Task</em>&nbsp;</td><td>A function object which implements the operator() and operator&lt;. operator&lt; must be a partial ordering.</td></tr>
  </table>
</dl>
<dl compact><dt><b>See also:</b></dt><dd>prio_thread_func </dd></dl>

<p>

<p>
Definition at line <a class="el" href="a00041.html#l00193">193</a> of file <a class="el" href="a00041.html">scheduling_policies.hpp</a>.<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef Task&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00020.html#98e46d78da3e3755e489a90d18e69b83">task_type</a></td></tr>

<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00020.html#0533d1d83d26c88d607f35b61254563d">clear</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00020.html#18f497b423cdf0ca1216426adbbe99bc">empty</a> () const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00020.html#d25be1fea45efe649c11cd3a8f21a107">pop</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00020.html#c2a0b7f1213770f1ab1e09dc404a93fb">push</a> (<a class="el" href="a00020.html#98e46d78da3e3755e489a90d18e69b83">task_type</a> const &amp;task)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">size_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00020.html#20285a85573b5262b1417d68c4e8f486">size</a> () const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00020.html#98e46d78da3e3755e489a90d18e69b83">task_type</a> const &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00020.html#3545e79b7450900119eb6905c197769e">top</a> () const </td></tr>

<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">std::priority_queue&lt; <a class="el" href="a00020.html#98e46d78da3e3755e489a90d18e69b83">task_type</a> &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00020.html#32a5287bac7e585b01b3a30fd2585715">m_container</a></td></tr>

</table>
<hr><h2>Member Typedef Documentation</h2>
<a class="anchor" name="98e46d78da3e3755e489a90d18e69b83"></a><!-- doxytag: member="boost::threadpool::prio_scheduler::task_type" ref="98e46d78da3e3755e489a90d18e69b83" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = prio_task_func&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">typedef Task <a class="el" href="a00020.html">boost::threadpool::prio_scheduler</a>&lt; Task &gt;::<a class="el" href="a00020.html#98e46d78da3e3755e489a90d18e69b83">task_type</a>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Indicates the scheduler's task type. 
<p>

<p>
Definition at line <a class="el" href="a00041.html#l00196">196</a> of file <a class="el" href="a00041.html">scheduling_policies.hpp</a>.    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="0533d1d83d26c88d607f35b61254563d"></a><!-- doxytag: member="boost::threadpool::prio_scheduler::clear" ref="0533d1d83d26c88d607f35b61254563d" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = prio_task_func&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">void <a class="el" href="a00020.html">boost::threadpool::prio_scheduler</a>&lt; Task &gt;::clear           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Removes all tasks from the scheduler. 
<p>
Definition at line <a class="el" href="a00041.html#l00248">248</a> of file <a class="el" href="a00041.html">scheduling_policies.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="18f497b423cdf0ca1216426adbbe99bc"></a><!-- doxytag: member="boost::threadpool::prio_scheduler::empty" ref="18f497b423cdf0ca1216426adbbe99bc" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = prio_task_func&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">bool <a class="el" href="a00020.html">boost::threadpool::prio_scheduler</a>&lt; Task &gt;::empty           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Checks if the scheduler is empty. <dl compact><dt><b>Returns:</b></dt><dd>true if the scheduler contains no tasks, false otherwise. </dd></dl>
<dl compact><dt><b>Remarks:</b></dt><dd>Is more efficient than <a class="el" href="a00020.html#20285a85573b5262b1417d68c4e8f486">size()</a> == 0. </dd></dl>

<p>
Definition at line <a class="el" href="a00041.html#l00241">241</a> of file <a class="el" href="a00041.html">scheduling_policies.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="d25be1fea45efe649c11cd3a8f21a107"></a><!-- doxytag: member="boost::threadpool::prio_scheduler::pop" ref="d25be1fea45efe649c11cd3a8f21a107" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = prio_task_func&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">void <a class="el" href="a00020.html">boost::threadpool::prio_scheduler</a>&lt; Task &gt;::pop           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Removes the task which should be executed next. 
<p>
Definition at line <a class="el" href="a00041.html#l00215">215</a> of file <a class="el" href="a00041.html">scheduling_policies.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="c2a0b7f1213770f1ab1e09dc404a93fb"></a><!-- doxytag: member="boost::threadpool::prio_scheduler::push" ref="c2a0b7f1213770f1ab1e09dc404a93fb" args="(task_type const &amp;task)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = prio_task_func&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">bool <a class="el" href="a00020.html">boost::threadpool::prio_scheduler</a>&lt; Task &gt;::push           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a00020.html#98e46d78da3e3755e489a90d18e69b83">task_type</a> const &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>task</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Adds a new task to the scheduler. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>task</em>&nbsp;</td><td>The task object. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>true, if the task could be scheduled and false otherwise. </dd></dl>

<p>
Definition at line <a class="el" href="a00041.html#l00207">207</a> of file <a class="el" href="a00041.html">scheduling_policies.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="20285a85573b5262b1417d68c4e8f486"></a><!-- doxytag: member="boost::threadpool::prio_scheduler::size" ref="20285a85573b5262b1417d68c4e8f486" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = prio_task_func&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">size_t <a class="el" href="a00020.html">boost::threadpool::prio_scheduler</a>&lt; Task &gt;::size           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Gets the current number of tasks in the scheduler. <dl compact><dt><b>Returns:</b></dt><dd>The number of tasks. </dd></dl>
<dl compact><dt><b>Remarks:</b></dt><dd>Prefer <a class="el" href="a00020.html#18f497b423cdf0ca1216426adbbe99bc">empty()</a> to <a class="el" href="a00020.html#20285a85573b5262b1417d68c4e8f486">size()</a> == 0 to check if the scheduler is empty. </dd></dl>

<p>
Definition at line <a class="el" href="a00041.html#l00232">232</a> of file <a class="el" href="a00041.html">scheduling_policies.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="3545e79b7450900119eb6905c197769e"></a><!-- doxytag: member="boost::threadpool::prio_scheduler::top" ref="3545e79b7450900119eb6905c197769e" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = prio_task_func&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="a00020.html#98e46d78da3e3755e489a90d18e69b83">task_type</a> const&amp; <a class="el" href="a00020.html">boost::threadpool::prio_scheduler</a>&lt; Task &gt;::top           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Gets the task which should be executed next. <dl compact><dt><b>Returns:</b></dt><dd>The task object to be executed. </dd></dl>

<p>
Definition at line <a class="el" href="a00041.html#l00223">223</a> of file <a class="el" href="a00041.html">scheduling_policies.hpp</a>.    </td>
  </tr>
</table>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="32a5287bac7e585b01b3a30fd2585715"></a><!-- doxytag: member="boost::threadpool::prio_scheduler::m_container" ref="32a5287bac7e585b01b3a30fd2585715" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = prio_task_func&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">std::priority_queue&lt;<a class="el" href="a00020.html#98e46d78da3e3755e489a90d18e69b83">task_type</a>&gt; <a class="el" href="a00020.html">boost::threadpool::prio_scheduler</a>&lt; Task &gt;::<a class="el" href="a00020.html#32a5287bac7e585b01b3a30fd2585715">m_container</a><code> [protected]</code>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Internal task container. 
<p>

<p>
Definition at line <a class="el" href="a00041.html#l00199">199</a> of file <a class="el" href="a00041.html">scheduling_policies.hpp</a>.    </td>
  </tr>
</table>
    <BR>
    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>
		  <TD CLASS="tiny" ALIGN="LEFT">Copyright &copy 2005-2007 Philipp Henkel</TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="../index.html">Overview</A> |
            <A CLASS="qindex" HREF="../reference/annotated.html">Reference</A> |
            <A CLASS="qindex" HREF="../tutorial/intro.html">Tutorial</A> |
            <A CLASS="qindex" HREF="../examples/intro.html">Examples</A> |
            <A CLASS="qindex" HREF="../design/intro.html">Design</A>
          </TD>
        </TR>       
      </TABLE>
    </DIV>  
  </BODY>
</HTML>
